package org.applet.game.framework.component;

import java.awt.Color;
import java.awt.Event;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.TextField;
import java.awt.image.ImageObserver;

import org.applet.game.framework.core.Widget;
import org.applet.game.framework.event.KeyAdapter;
import org.applet.game.framework.event.MouseAdapter;
import org.applet.game.framework.util.TimerUtil;

public class TextInput extends Widget {

	public TextField textField = new TextField();
	
	@Override
	public void setSize(int width, int height) {
		textField.setSize(width, height);
	}
	
	@Override
	public void setLocation(int x, int y) {
		textField.setLocation(x, y);
	}
	
	public TextInput()
	{
//		setDefaultMouselistener(new MouseAdapter(){
//			@Override
//			public boolean mouseDown(Event e) {
//				requestFocus();
//				return false;
//			}
//		});
		textField.addMouseListener(new java.awt.event.MouseAdapter() {
			
		});
	}
	
	@Override
	public boolean mouseDown(Event e) {
		requestFocus();
		return false;
	}
	
	@Override
	public void render(Graphics2D painter, ImageObserver observer) {
//		painter.setColor(Color.WHITE);
//		painter.fillRect(x, y, width, height);
//
//		painter.setColor(Color.BLACK);
//		painter.setFont(font);
//		//painter.
//		if(text != null)
//			painter.drawString(text, x, y);
//		if(focus && showIndex)
//		{
//			painter.fillRect(x, y, 2, height);
//		}
	}

	@Override
	public void render(Graphics2D painter, ImageObserver observer, int offsetX,
			int offsetY) {
		// TODO Auto-generated method stub
		
	}
}
